export default {
	//数据
	data() {
		return {
      thatUrl: this.urls.baseUrl,
			id: this.get("baseDetailsid"),
			base: {},
			curId: 0,
			types: '', // 基地类别
			logisticsList: [], // 建设
      cooperativeExpertList: [] ,//合作专家
      //projectCooperativeExpertList: [], //项目合作专家集合
      fatherIndex:0, //一级菜单下标
    }
	},
	created() { //调用方法
		let that = this;
		console.log('基地详情id' + that.id)
		if(that.id) {
			// 基地信息
			that.$post(
					that.urls.getBaseAreas, {
						"id": that.id,
					}
				)
				.then(function(res) {
					if(res.success) {
						that.base = res.data;
						let type = that.base.type;
						if(type == 0) {
							that.types = '现代农业综合示范基地';
						} else if(type == 1) {
							that.types = '现代农业特色产业基地';
						} else if(type == 2) {
							that.types = '乡村建设研究实践基地';
						} else if(type == 3) {
							that.types = '新农村建设分布式服务站';
						}

					}
				})
			// 專家信息
			that.$post(
					that.urls.getBaseExperts, {
						"list": [that.id],
					}
				)
				.then(function(res) {
					if(res.success) {
						that.experts = res.pageInfo.list;
					}
				})
			// 建设

			that.$post(
					that.urls.getConstructionPage, {
						"baseId": that.id, "pageNum": 1, "pageSize": 9999999
					}
				)
				.then(function(res) {
					if(res.success) {
						  that.logisticsList = res.pageInfo.list;
					}
				})
      //查询项目合作专家
      //that.findAllProjectCooperative(that.id);
      that.findAllCooperativeExpert(that.id);
		}
	},
	mounted() {

	},
	updated:function(){
		if(this.getParamValue("fatherIndex")){
			this.fatherIndex=this.getParamValue("fatherIndex");
		}
	},
	methods: { //写函数方法
    //查询所有专家项目合作信息
    /*findAllProjectCooperative: function(id) {
      var that = this;
      that.projectCooperativeExpertList = [];
      if (id != null) {
        that.$post(
          that.urls.getAllProjectCooperative,
          {"areasId": id}
        ).then(function(res) {
          if(res.success) {
            that.projectCooperativeExpertList = res.data;
          }
        })
      }
    },*/
    //查询所有合作专家
    findAllCooperativeExpert: function(id) {
      var that = this;
      that.cooperativeExpertList = [];
      if (id != null) {
        that.$post(
          that.urls.getAllCooperativeExpert,
          {"areasId": id}
        ).then(function(res) {
          if(res.success) {
            that.cooperativeExpertList = res.data;
          }
        })
      }
    },
    subStr: function (str) {
      if(str.length > 8){
        let s = str.substr(0, 8);
        return s+ '...';
      }else {
        return str;
      }
    }
	}
}
